<?php
require_once 'pojos/CookieType.php';
require_once 'model/CookieTypeDao.php';

$cookieTypeDao = new CookieTypeDao();
$cookieTypes = $cookieTypeDao->getAllCookieType();

?>
<form action="thembanh.php" method="post" enctype="multipart/form-data">
    <center>
        <p><h2>Thêm Bánh Mới</h2></p>
        <table width="80%">
            <tr>
                <td>
                    Tên bánh:
                </td>
                <td>
                    <input name="cookieName" type="text" style="width:300px"/>
                </td>
            </tr>
            
            <tr>
                <td>
                    Giá:
                </td>
                <td>
                    <input name="price" type="text" style="width:300px"/>
                </td>
            </tr>
            
            <tr>
                <td>
                    Loại bánh:
                </td>
                <td>
                    <select name="cookieType">
                        <?php
                        foreach ($cookieTypes as $cookieType) {
                            echo '<option value="' . $cookieType->getId() . '">' . $cookieType->getTypeName() . '</option>';
                        }
                        ?>
                    </select>
                </td>
            </tr>
            
            <tr>
                <td>
                    Thông tin thêm:
                </td>
                <td>
                    <textarea name="description" row="4" cols="35"></textarea>
                </td>
            </tr>
            
            <tr>
                <td>
                    Hình ảnh:
                </td>
                <td>
                    <input type="file" name="image" style="width:300px" id="image"/>
                </td>
            </tr>
        </table>
    <input type="submit" name="AddCookie" value="Thêm bánh"/>
    </center>
</form>